var KOC = require("koc.common.utils");
var Config = require("../../config");
var ExcelExport = require('excel-export');
var StateData = require("../statedata");
var DALFactory = require("../../lib/dal/dal-factory");
var CommonUtils = require("../../lib/common-utils");

module.exports = {
    Main: function (req, res, callback) {
        res.render("user-manage/main", callback);
    },
    Info_Manage: {
        Avatar: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                message: "",
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            CommonUtils.Common.PageScript_PageData(res, _PageData);
            res.render("user-manage/info-manage/avatar", callback);
        },
        Cover: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                message: "",
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            CommonUtils.Common.PageScript_PageData(res, _PageData);
            res.render("user-manage/info-manage/cover", callback);
        },
        List: function (req, res, callback) {
            res.render("user-manage/info-manage/list", callback);
        },
        Info: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.User_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/info-manage/info", callback);
                return;
            }

            KOC.Async.parallel([
                //用户信息列表
                function (callback) {
                    DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.NickName = retValue.returnObject.NickName;
                        _PageData.Sex = retValue.returnObject.Sex;
                        _PageData.RealName = retValue.returnObject.RealName;
                        _PageData.Email = retValue.returnObject.Email;
                        _PageData.Phone = retValue.returnObject.Phone;
                        _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                        _PageData.EXP = retValue.returnObject.EXP;
                        _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Coin = retValue.returnObject.Coin;
                        _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                        _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                        _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                        _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                        _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                        _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                        _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                        _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                        _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                        _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.Fans = retValue.returnObject.Fans;
                        _PageData.Attention = retValue.returnObject.Attention;
                        _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                        _PageData.IsFamily = retValue.returnObject.IsFamily;
                        _PageData.Login_Count = retValue.returnObject.Login_Count;
                        _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                        _PageData.Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Status = retValue.returnObject.Status;

                        callback(null);
                    });
                },
                // 艺人信息列表
                function (callback) {
                    DALFactory.User.User_Anchor.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        if (!retValue.returnObject) {
                            _PageData.flag = retValue.message;
                            CommonUtils.Common.PageScript_PageData(res, _PageData);
                            res.render("user-manage/info-manage/info", callback);
                            return;
                        }

                        _PageData.Anchor_User_ID = retValue.returnObject.User_ID;
                        _PageData.Family_Commission = retValue.returnObject.Family_Commission;
                        _PageData.RoomName = retValue.returnObject.RoomName;
                        _PageData.RoomWelcome = retValue.returnObject.RoomWelcome;
                        _PageData.Tags = retValue.returnObject.Tags;
                        _PageData.Anchor_EXP = retValue.returnObject.EXP;
                        _PageData.Pomelo = retValue.returnObject.Pomelo;
                        _PageData.Pomelo_Today = retValue.returnObject.Pomelo_Today;
                        _PageData.Pomelo_Week = retValue.returnObject.Pomelo_Week;
                        _PageData.Pomelo_Month = retValue.returnObject.Pomelo_Month;
                        _PageData.Pomelo_Year = retValue.returnObject.Pomelo_Year;
                        _PageData.Live = retValue.returnObject.Live;
                        _PageData.Live_StartTime = retValue.returnObject.Live_StartTime;
                        _PageData.Live_Order_No = retValue.returnObject.Live_Order_No;
                        _PageData.Live_Duration_Total = retValue.returnObject.Live_Duration_Total;
                        _PageData.IDCard = retValue.returnObject.IDCard;
                        _PageData.Anchor_Phone = retValue.returnObject.Phone;
                        _PageData.Anchor_Email = retValue.returnObject.Email;
                        _PageData.QQ = retValue.returnObject.QQ;
                        _PageData.Network = retValue.returnObject.Network;
                        _PageData.Account_BankName = retValue.returnObject.Account_BankName;
                        _PageData.Account_BankFullName = retValue.returnObject.Account_BankFullName;
                        _PageData.Account_RealName = retValue.returnObject.Account_RealName;
                        _PageData.Account_CardNo = retValue.returnObject.Account_CardNo;
                        _PageData.List_Order = retValue.returnObject.List_Order;
                        _PageData.Anchor_Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Anchor_Status = retValue.returnObject.Status;
                        _PageData.Anchor_Level = retValue.returnObject.Level;
                        _PageData.Level_Next = retValue.returnObject.Level_Next;
                        _PageData.EXP_Next = retValue.returnObject.EXP_Next;
                        _PageData.EXP_Difference = retValue.returnObject.EXP_Difference;

                        callback(null);
                    });
                },
                // 公会信息列表
                function (callback) {
                    DALFactory.User.Family_Info.Info_UserID(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        if (!retValue.returnObject) {
                            _PageData.flag = retValue.message;
                            CommonUtils.Common.PageScript_PageData(res, _PageData);
                            res.render("user-manage/info-manage/info", callback);
                            return;
                        }

                        _PageData.Family_User_ID = retValue.returnObject.User_ID;
                        _PageData.Family_Name = retValue.returnObject.Family_Name;
                        _PageData.Family_Account_BankName = retValue.returnObject.Account_BankName;
                        _PageData.Family_Account_BankFullName = retValue.returnObject.Account_BankFullName;
                        _PageData.Family_Account_RealName = retValue.returnObject.Account_RealName;
                        _PageData.Family_Account_CardNo = retValue.returnObject.Account_CardNo;
                        _PageData.Family_Beans = retValue.returnObject.Beans;
                        _PageData.Family_Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.Family_ContactName = retValue.returnObject.ContactName;
                        _PageData.Family_IDCard = retValue.returnObject.IDCard;
                        _PageData.Family_Phone = retValue.returnObject.Phone;
                        _PageData.Family_Email = retValue.returnObject.Email;
                        _PageData.Family_QQ = retValue.returnObject.QQ;
                        _PageData.Family_Status = retValue.returnObject.Status;

                        callback(null);
                    });
                },
                // 管理员信息列表
                function (callback) {
                    DALFactory.User.User_Admin.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        if (!retValue.returnObject) {
                            _PageData.flag = retValue.message;
                            CommonUtils.Common.PageScript_PageData(res, _PageData);
                            res.render("user-manage/info-manage/info", callback);
                            return;
                        }

                        _PageData.Admin_User_ID = retValue.returnObject.User_ID;
                        _PageData.Admin_Phone = retValue.returnObject.Phone;
                        _PageData.Admin_RealName = retValue.returnObject.RealName;
                        _PageData.Admin_IsMaster = retValue.returnObject.IsMaster;
                        _PageData.Admin_Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Admin_Status = retValue.returnObject.Status;

                        callback(null);
                    });
                }
            ], function (retValue) {
                if (retValue) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/info-manage/info", callback);
                    return;
                }
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/info-manage/info", callback);
            });
        },
        Edit: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.User_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/info-manage/edit", callback);
                return;
            }
            DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                if (retValue.hasError) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/info-manage/edit", callback);
                    return;
                }
                _PageData.User_ID = retValue.returnObject.User_ID;
                _PageData.NickName = retValue.returnObject.NickName;
                _PageData.Sex = retValue.returnObject.Sex;
                _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                _PageData.EXP = retValue.returnObject.EXP;
                _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                _PageData.Coin = retValue.returnObject.Coin;
                _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                _PageData.Beans = retValue.returnObject.Beans;
                _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                _PageData.Fans = retValue.returnObject.Fans;
                _PageData.Attention = retValue.returnObject.Attention;
                _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                _PageData.IsFamily = retValue.returnObject.IsFamily;
                _PageData.Login_Count = retValue.returnObject.Login_Count;
                _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                _PageData.Create_Date = retValue.returnObject.Create_Date;
                _PageData.Status = retValue.returnObject.Status;
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/info-manage/edit", callback);
            });
        },
        ConsumeList: function (req, res, callback) {
            res.render("user-manage/info-manage/consumelist", callback);
        },
        PayList: function (req, res, callback) {
            res.render("user-manage/info-manage/paylist", callback);
        },
        Add_Subtract: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.User_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/info-manage/add-subtract", callback);
                return;
            }
            DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                if (retValue.hasError) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/info-manage/add-subtract", callback);
                    return;
                }
                _PageData.User_ID = retValue.returnObject.User_ID;
                _PageData.NickName = retValue.returnObject.NickName;
                _PageData.Sex = retValue.returnObject.Sex;
                _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                _PageData.EXP = retValue.returnObject.EXP;
                _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                _PageData.Coin = retValue.returnObject.Coin;
                _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                _PageData.Beans = retValue.returnObject.Beans;
                _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                _PageData.Fans = retValue.returnObject.Fans;
                _PageData.Attention = retValue.returnObject.Attention;
                _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                _PageData.IsFamily = retValue.returnObject.IsFamily;
                _PageData.Login_Count = retValue.returnObject.Login_Count;
                _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                _PageData.Create_Date = retValue.returnObject.Create_Date;
                _PageData.Status = retValue.returnObject.Status;
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/info-manage/add-subtract", callback);
            });
        },
        GrantList: function (req, res, callback) {
            res.render("user-manage/info-manage/grantlist", callback);
        },
        AvatarManage: function (req, res, callback) {
            res.render("user-manage/info-manage/avatar-manage", callback);
        },
        Avatar_Edit: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.User_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/info-manage/avatar-edit", callback);
                return;
            }
            DALFactory.User.User_Anchor.User_Anchor_Cover(_PageData.User_ID, function (retValue) {
                if (retValue.hasError) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/info-manage/avatar-edit", callback);
                    return;
                }
                _PageData.User_ID = retValue.returnObject.User_ID;
                _PageData.NickName = retValue.returnObject.NickName;
                _PageData.Create_Date = retValue.returnObject.Create_Date;
                _PageData.Image = retValue.returnObject.Image;
                _PageData.Create_IP = retValue.returnObject.Create_IP;
                _PageData.Status = retValue.returnObject.Status;
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/info-manage/avatar-edit", callback);
            });

        },
        AddGrant: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            _PageData.Mounts = CommonUtils.Commodity.Mounts.Data;
            _PageData.VIP = CommonUtils.Commodity.VIP.Data;
            CommonUtils.Common.PageScript_PageData(res, _PageData);
            res.render("user-manage/info-manage/addgrant", callback);
        }
    },
    Anchor_Manage: {
        List: function (req, res, callback) {
            res.render("user-manage/anchor-manage/list", callback);
        },
        Info: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.User_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/info", callback);
                return;
            }

            KOC.Async.parallel([
                //用户信息列表
                function (callback) {
                    DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.NickName = retValue.returnObject.NickName;
                        _PageData.Sex = retValue.returnObject.Sex;
                        _PageData.RealName = retValue.returnObject.RealName;
                        //_PageData.Email = retValue.returnObject.Email;
                        //_PageData.Phone = retValue.returnObject.Phone;
                        _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                        _PageData.EXP = retValue.returnObject.EXP;
                        // _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Coin = retValue.returnObject.Coin;
                        _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                        _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                        _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                        _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                        _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                        _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                        _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                        _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                        _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                        _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.Fans = retValue.returnObject.Fans;
                        _PageData.Attention = retValue.returnObject.Attention;
                        _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                        _PageData.IsFamily = retValue.returnObject.IsFamily;
                        _PageData.Login_Count = retValue.returnObject.Login_Count;
                        _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                        _PageData.Create_Date = retValue.returnObject.Create_Date;
                        //_PageData.Status = retValue.returnObject.Status;

                        callback(null);
                    });
                },
                // 艺人信息列表
                function (callback) {
                    DALFactory.User.User_Anchor.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }

                        _PageData.Family_Commission = retValue.returnObject.Family_Commission;
                        _PageData.Family_ID = retValue.returnObject.Family_ID;
                        _PageData.RoomName = retValue.returnObject.RoomName;
                        _PageData.RoomWelcome = retValue.returnObject.RoomWelcome;
                        _PageData.Tags = retValue.returnObject.Tags;
                        // _PageData.Anchor_EXP = retValue.returnObject.EXP;
                        _PageData.Level = CommonUtils.Anchor.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Pomelo = retValue.returnObject.Pomelo;
                        _PageData.Pomelo_Today = retValue.returnObject.Pomelo_Today;
                        _PageData.Pomelo_Week = retValue.returnObject.Pomelo_Week;
                        _PageData.Pomelo_Month = retValue.returnObject.Pomelo_Month;
                        _PageData.Pomelo_Year = retValue.returnObject.Pomelo_Year;
                        _PageData.Live = retValue.returnObject.Live;
                        _PageData.Live_StartTime = retValue.returnObject.Live_StartTime;
                        _PageData.Live_Order_No = retValue.returnObject.Live_Order_No;
                        _PageData.Live_Duration_Total = retValue.returnObject.Live_Duration_Total;
                        _PageData.IDCard = retValue.returnObject.IDCard;
                        _PageData.Anchor_Phone = retValue.returnObject.Phone;
                        _PageData.Anchor_Email = retValue.returnObject.Email;
                        _PageData.Anchor_QQ = retValue.returnObject.QQ;
                        _PageData.Network = retValue.returnObject.Network;
                        _PageData.Account_BankName = retValue.returnObject.Account_BankName;
                        _PageData.Account_BankFullName = retValue.returnObject.Account_BankFullName;
                        _PageData.Account_RealName = retValue.returnObject.Account_RealName;
                        _PageData.Account_CardNo = retValue.returnObject.Account_CardNo;
                        _PageData.List_Order = retValue.returnObject.List_Order;
                        _PageData.Anchor_Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Anchor_Status = retValue.returnObject.Status;
                        _PageData.Anchor_Level = retValue.returnObject.Level;
                        _PageData.Level_Next = retValue.returnObject.Level_Next;
                        _PageData.EXP_Next = retValue.returnObject.EXP_Next;
                        _PageData.EXP_Difference = retValue.returnObject.EXP_Difference;
                        _PageData.Approve_Admin_ID = retValue.returnObject.Approve_Admin_ID;
                        _PageData.Approve_RealName = retValue.returnObject.Approve_RealName;
                        _PageData.Duty_Admin_ID = retValue.returnObject.Duty_Admin_ID;
                        _PageData.Duty_RealName = retValue.returnObject.Duty_RealName;
                        _PageData.Cover_Admin_ID = retValue.returnObject.Cover_Admin_ID;
                        _PageData.Cover_RealName = retValue.returnObject.Cover_RealName;
                        callback(null);
                    });
                }
            ], function (retValue) {
                if (retValue) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/anchor-manage/info", callback);
                    return;
                }
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/info", callback);
            })
        },
        Edit: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1),
                aaData: []
            };
            if (_PageData.User_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/edit", callback);
                return;
            }
            KOC.Async.parallel([
                //用户信息列表
                function (callback) {
                    DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.NickName = retValue.returnObject.NickName;
                        _PageData.Sex = retValue.returnObject.Sex;
                        _PageData.RealName = retValue.returnObject.RealName;
                        //_PageData.Email = retValue.returnObject.Email;
                        //_PageData.Phone = retValue.returnObject.Phone;
                        _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                        _PageData.EXP = retValue.returnObject.EXP;
                        // _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Coin = retValue.returnObject.Coin;
                        _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                        _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                        _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                        _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                        _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                        _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                        _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                        _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                        _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                        _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.Fans = retValue.returnObject.Fans;
                        _PageData.Attention = retValue.returnObject.Attention;
                        _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                        _PageData.IsFamily = retValue.returnObject.IsFamily;
                        _PageData.Login_Count = retValue.returnObject.Login_Count;
                        _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                        _PageData.Create_Date = retValue.returnObject.Create_Date;
                        //_PageData.Status = retValue.returnObject.Status;

                        callback(null);
                    });
                },
                // 艺人信息列表
                function (callback) {
                    DALFactory.User.User_Anchor.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.Family_Commission = retValue.returnObject.Family_Commission;
                        _PageData.Family_ID = retValue.returnObject.Family_ID;
                        _PageData.RoomName = retValue.returnObject.RoomName;
                        _PageData.RoomWelcome = retValue.returnObject.RoomWelcome;
                        _PageData.Tags = retValue.returnObject.Tags;
                        _PageData.Anchor_EXP = retValue.returnObject.EXP;
                        _PageData.Level = CommonUtils.Anchor.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Pomelo = retValue.returnObject.Pomelo;
                        _PageData.Pomelo_Today = retValue.returnObject.Pomelo_Today;
                        _PageData.Pomelo_Week = retValue.returnObject.Pomelo_Week;
                        _PageData.Pomelo_Month = retValue.returnObject.Pomelo_Month;
                        _PageData.Pomelo_Year = retValue.returnObject.Pomelo_Year;
                        _PageData.Live = retValue.returnObject.Live;
                        _PageData.Live_StartTime = retValue.returnObject.Live_StartTime;
                        _PageData.Live_Order_No = retValue.returnObject.Live_Order_No;
                        _PageData.Live_Duration_Total = retValue.returnObject.Live_Duration_Total;
                        _PageData.IDCard = retValue.returnObject.IDCard;
                        _PageData.Anchor_Phone = retValue.returnObject.Phone;
                        _PageData.Anchor_Email = retValue.returnObject.Email;
                        _PageData.QQ = retValue.returnObject.QQ;
                        _PageData.Network = retValue.returnObject.Network;
                        _PageData.Account_BankName = retValue.returnObject.Account_BankName;
                        _PageData.Account_BankFullName = retValue.returnObject.Account_BankFullName;
                        _PageData.Account_Province = retValue.returnObject.Account_Province;
                        _PageData.Account_City = retValue.returnObject.Account_City;
                        _PageData.Account_RealName = retValue.returnObject.Account_RealName;
                        _PageData.Account_CardNo = retValue.returnObject.Account_CardNo;
                        _PageData.List_Order = retValue.returnObject.List_Order;
                        _PageData.Anchor_Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Anchor_Status = retValue.returnObject.Status;
                        _PageData.Anchor_Level = retValue.returnObject.Level;
                        _PageData.IsRecommend = retValue.returnObject.IsRecommend;
                        _PageData.Level_Next = retValue.returnObject.Level_Next;
                        _PageData.EXP_Next = retValue.returnObject.EXP_Next;
                        _PageData.EXP_Difference = retValue.returnObject.EXP_Difference;
                        _PageData.Approve_Admin_ID = retValue.returnObject.Approve_Admin_ID;
                        _PageData.Approve_RealName = retValue.returnObject.Approve_RealName;
                        _PageData.Duty_Admin_ID = retValue.returnObject.Duty_Admin_ID;
                        _PageData.Duty_RealName = retValue.returnObject.Duty_RealName;
                        _PageData.Cover_Admin_ID = retValue.returnObject.Cover_Admin_ID;
                        _PageData.Cover_RealName = retValue.returnObject.Cover_RealName;
                        callback(null);
                    });
                },
                //管理员列表
                function (callback) {
                    DALFactory.User.User_Admin.Info_ALL(function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        KOC.Lodash.forEach(retValue.returnObject, function (ThisValue) {
                            _PageData.aaData.push({
                                User_ID: ThisValue.User_ID,
                                Phone: ThisValue.Phone,
                                RealName: ThisValue.RealName,
                                IsMaster: ThisValue.IsMaster,
                                RightCode: ThisValue.RightCode,
                                Create_Date: ThisValue.Create_Date,
                                Create_IP: ThisValue.Create_IP
                            })
                        });
                        callback();
                    });

                }
            ], function (retValue) {
                _PageData.TagsList = CommonUtils.Anchor.Tags;
                _PageData.Banks = CommonUtils.User.Banks;
                if (retValue) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/anchor-manage/edit", callback);
                    return;
                }
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/edit", callback);
            })
        },
        Turn_Family: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.User_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/turn-family", callback);
                return;
            }
            KOC.Async.parallel([
                //用户信息列表
                function (callback) {
                    DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.NickName = retValue.returnObject.NickName;
                        _PageData.Sex = retValue.returnObject.Sex;
                        _PageData.RealName = retValue.returnObject.RealName;
                        //_PageData.Email = retValue.returnObject.Email;
                        //_PageData.Phone = retValue.returnObject.Phone;
                        _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                        _PageData.EXP = retValue.returnObject.EXP;
                        // _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Coin = retValue.returnObject.Coin;
                        _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                        _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                        _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                        _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                        _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                        _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                        _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                        _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                        _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                        _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.Fans = retValue.returnObject.Fans;
                        _PageData.Attention = retValue.returnObject.Attention;
                        _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                        _PageData.IsFamily = retValue.returnObject.IsFamily;
                        _PageData.Login_Count = retValue.returnObject.Login_Count;
                        _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                        _PageData.Create_Date = retValue.returnObject.Create_Date;
                        //_PageData.Status = retValue.returnObject.Status;

                        callback(null);
                    });
                },
                // 艺人信息列表
                function (callback) {
                    DALFactory.User.User_Anchor.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.Family_Commission = retValue.returnObject.Family_Commission;
                        _PageData.Family_ID = retValue.returnObject.Family_ID;
                        _PageData.RoomName = retValue.returnObject.RoomName;
                        _PageData.RoomWelcome = retValue.returnObject.RoomWelcome;
                        _PageData.Tags = retValue.returnObject.Tags;
                        _PageData.Anchor_EXP = retValue.returnObject.EXP;
                        _PageData.Level = CommonUtils.Anchor.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Pomelo = retValue.returnObject.Pomelo;
                        _PageData.Pomelo_Today = retValue.returnObject.Pomelo_Today;
                        _PageData.Pomelo_Week = retValue.returnObject.Pomelo_Week;
                        _PageData.Pomelo_Month = retValue.returnObject.Pomelo_Month;
                        _PageData.Pomelo_Year = retValue.returnObject.Pomelo_Year;
                        _PageData.Live = retValue.returnObject.Live;
                        _PageData.Live_StartTime = retValue.returnObject.Live_StartTime;
                        _PageData.Live_Order_No = retValue.returnObject.Live_Order_No;
                        _PageData.Live_Duration_Total = retValue.returnObject.Live_Duration_Total;
                        _PageData.IDCard = retValue.returnObject.IDCard;
                        _PageData.Anchor_Phone = retValue.returnObject.Phone;
                        _PageData.Anchor_Email = retValue.returnObject.Email;
                        _PageData.QQ = retValue.returnObject.QQ;
                        _PageData.Network = retValue.returnObject.Network;
                        _PageData.Account_BankName = retValue.returnObject.Account_BankName;
                        _PageData.Account_BankFullName = retValue.returnObject.Account_BankFullName;
                        _PageData.Account_Province = retValue.returnObject.Account_Province;
                        _PageData.Account_City = retValue.returnObject.Account_City;
                        _PageData.Account_RealName = retValue.returnObject.Account_RealName;
                        _PageData.Account_CardNo = retValue.returnObject.Account_CardNo;
                        _PageData.List_Order = retValue.returnObject.List_Order;
                        _PageData.Anchor_Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Anchor_Status = retValue.returnObject.Status;
                        _PageData.Anchor_Level = retValue.returnObject.Level;
                        _PageData.Level_Next = retValue.returnObject.Level_Next;
                        _PageData.EXP_Next = retValue.returnObject.EXP_Next;
                        _PageData.EXP_Difference = retValue.returnObject.EXP_Difference;

                        callback(null);
                    });
                }
            ], function (retValue) {
                _PageData.TagsList = CommonUtils.Anchor.Tags;
                _PageData.Banks = CommonUtils.User.Banks;
                if (retValue) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/anchor-manage/turn-family", callback);
                    return;
                }
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/turn-family", callback);
            })
        },
        Apply_List: function (req, res, callback) {
            res.render("user-manage/anchor-manage/apply-list", callback);
        },
        Apply_Edit: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1),
                aaData: []
            };
            if (_PageData.User_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/apply-edit", callback);
                return;
            }

            KOC.Async.parallel([
                //用户信息列表
                function (callback) {
                    DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.NickName = retValue.returnObject.NickName;
                        _PageData.Sex = retValue.returnObject.Sex;
                        _PageData.RealName = retValue.returnObject.RealName;
                        //_PageData.Email = retValue.returnObject.Email;
                        //_PageData.Phone = retValue.returnObject.Phone;
                        _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                        _PageData.EXP = retValue.returnObject.EXP;
                        _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Coin = retValue.returnObject.Coin;
                        _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                        _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                        _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                        _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                        _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                        _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                        _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                        _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                        _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                        _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.Fans = retValue.returnObject.Fans;
                        _PageData.Attention = retValue.returnObject.Attention;
                        _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                        _PageData.IsFamily = retValue.returnObject.IsFamily;
                        _PageData.Login_Count = retValue.returnObject.Login_Count;
                        _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                        _PageData.Create_Date = retValue.returnObject.Create_Date;
                        //_PageData.Status = retValue.returnObject.Status;

                        callback(null);
                    });
                },
                // 艺人信息列表
                function (callback) {
                    DALFactory.User.User_Anchor.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.Family_Commission = retValue.returnObject.Family_Commission;
                        _PageData.RoomName = retValue.returnObject.RoomName;
                        _PageData.RoomWelcome = retValue.returnObject.RoomWelcome;
                        _PageData.Tags = retValue.returnObject.Tags;
                        _PageData.Anchor_EXP = retValue.returnObject.EXP;
                        _PageData.Pomelo = retValue.returnObject.Pomelo;
                        _PageData.Pomelo_Today = retValue.returnObject.Pomelo_Today;
                        _PageData.Pomelo_Week = retValue.returnObject.Pomelo_Week;
                        _PageData.Pomelo_Month = retValue.returnObject.Pomelo_Month;
                        _PageData.Pomelo_Year = retValue.returnObject.Pomelo_Year;
                        _PageData.Live = retValue.returnObject.Live;
                        _PageData.Live_StartTime = retValue.returnObject.Live_StartTime;
                        _PageData.Live_Order_No = retValue.returnObject.Live_Order_No;
                        _PageData.Live_Duration_Total = retValue.returnObject.Live_Duration_Total;
                        _PageData.IDCard = retValue.returnObject.IDCard;
                        _PageData.Anchor_Phone = retValue.returnObject.Phone;
                        _PageData.Anchor_Email = retValue.returnObject.Email;
                        _PageData.Anchor_QQ = retValue.returnObject.QQ;
                        _PageData.Network = retValue.returnObject.Network;
                        _PageData.Account_BankName = retValue.returnObject.Account_BankName;
                        _PageData.Account_BankFullName = retValue.returnObject.Account_BankFullName;
                        _PageData.Account_RealName = retValue.returnObject.Account_RealName;
                        _PageData.Account_CardNo = retValue.returnObject.Account_CardNo;
                        _PageData.List_Order = retValue.returnObject.List_Order;
                        _PageData.Anchor_Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Anchor_Status = retValue.returnObject.Status;
                        _PageData.Anchor_Level = retValue.returnObject.Level;
                        _PageData.Level_Next = retValue.returnObject.Level_Next;
                        _PageData.EXP_Next = retValue.returnObject.EXP_Next;
                        _PageData.EXP_Difference = retValue.returnObject.EXP_Difference;
                        _PageData.Approve_Admin_ID = retValue.returnObject.Approve_Admin_ID;
                        _PageData.Approve_RealName = retValue.returnObject.Approve_RealName;
                        _PageData.Duty_Admin_ID = retValue.returnObject.Duty_Admin_ID;
                        _PageData.Duty_RealName = retValue.returnObject.Duty_RealName;
                        _PageData.Cover_Admin_ID = retValue.returnObject.Cover_Admin_ID;
                        _PageData.Cover_RealName = retValue.returnObject.Cover_RealName;
                        callback(null);
                    });
                },
                //管理员列表
                function (callback) {
                    DALFactory.User.User_Admin.Info_ALL(function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        KOC.Lodash.forEach(retValue.returnObject, function (ThisValue) {
                            _PageData.aaData.push({
                                User_ID: ThisValue.User_ID,
                                Phone: ThisValue.Phone,
                                RealName: ThisValue.RealName,
                                IsMaster: ThisValue.IsMaster,
                                RightCode: ThisValue.RightCode,
                                Create_Date: ThisValue.Create_Date,
                                Create_IP: ThisValue.Create_IP
                            })
                        });
                        callback();
                    });

                }
            ], function (retValue) {
                if (retValue) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/anchor-manage/apply-edit", callback);
                    return;
                }
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/apply-edit", callback);
            })
        },
        Img_List: function (req, res, callback) {
            res.render("user-manage/anchor-manage/img-list", callback);
        },
        Img_Edit: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                User_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.User_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/img-edit", callback);
                return;
            }
            DALFactory.User.User_Anchor.User_Anchor_Cover(_PageData.User_ID, function (retValue) {
                if (retValue.hasError) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/anchor-manage/img-edit", callback);
                    return;
                }
                _PageData.User_ID = retValue.returnObject.User_ID;
                _PageData.NickName = retValue.returnObject.NickName;
                _PageData.Create_Date = retValue.returnObject.Create_Date;
                _PageData.Image = retValue.returnObject.Image;
                _PageData.Create_IP = retValue.returnObject.Create_IP;
                _PageData.Status = retValue.returnObject.Status;
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/anchor-manage/img-edit", callback);
            });

        },
        AnchorLog: function (req, res, callback) {
            res.render("user-manage/anchor-manage/anchorlog", callback);
        }
    },
    Family_Manage: {
        FamilyList: function (req, res, callback) {
            res.render("user-manage/family-manage/familylist", callback);
        },
        Apply_List: function (req, res, callback) {
            res.render("user-manage/family-manage/apply-list", callback);
        },
        Info: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                Family_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.Family_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/family-manage/info", callback);
                return;
            }

            KOC.Async.series([
                // 公会信息列表
                function (callback) {
                    DALFactory.User.Family_Info.Info(_PageData.Family_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.Family_ID = retValue.returnObject.Family_ID;
                        _PageData.Family_Name = retValue.returnObject.Family_Name;
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.Account_BankName = retValue.returnObject.Account_BankName;
                        _PageData.Account_BankFullName = retValue.returnObject.Account_BankFullName;
                        _PageData.Account_RealName = retValue.returnObject.Account_RealName;
                        _PageData.Account_CardNo = retValue.returnObject.Account_CardNo;
                        _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.ContactName = retValue.returnObject.ContactName;
                        _PageData.IDCard = retValue.returnObject.IDCard;
                        _PageData.Family_Phone = retValue.returnObject.Phone;
                        _PageData.Family_QQ = retValue.returnObject.QQ;
                        _PageData.Family_Email = retValue.returnObject.Email;
                        _PageData.Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Status = retValue.returnObject.Status;
                        _PageData.Create_IP = retValue.returnObject.Create_IP;
                        callback();
                    });
                },
                //用户信息列表
                function (callback) {
                    DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.NickName = retValue.returnObject.NickName;
                        _PageData.Sex = retValue.returnObject.Sex;
                        _PageData.RealName = retValue.returnObject.RealName;
                        //_PageData.Email = retValue.returnObject.Email;
                        //_PageData.Phone = retValue.returnObject.Phone;
                        _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                        _PageData.EXP = retValue.returnObject.EXP;
                        _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Coin = retValue.returnObject.Coin;
                        _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                        _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                        _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                        _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                        _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                        // _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                        _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                        _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                        _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                        // _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.Fans = retValue.returnObject.Fans;
                        _PageData.Attention = retValue.returnObject.Attention;
                        _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                        _PageData.IsFamily = retValue.returnObject.IsFamily;
                        _PageData.Login_Count = retValue.returnObject.Login_Count;
                        _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                        // _PageData.Create_Date = retValue.returnObject.Create_Date;
                        //_PageData.Status = retValue.returnObject.Status;
                        callback();
                    });
                }
            ], function (retValue) {
                if (retValue) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/family-manage/info", callback);
                    return;
                }
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/family-manage/info", callback);
            })
        },
        Edit: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                Family_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.Family_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/family-manage/edit", callback);
                return;
            }

            KOC.Async.series([
                // 公会信息列表
                function (callback) {
                    DALFactory.User.Family_Info.Info(_PageData.Family_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.Family_ID = retValue.returnObject.Family_ID;
                        _PageData.Family_Name = retValue.returnObject.Family_Name;
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.Account_BankName = retValue.returnObject.Account_BankName;
                        _PageData.Account_BankFullName = retValue.returnObject.Account_BankFullName;
                        _PageData.Account_RealName = retValue.returnObject.Account_RealName;
                        _PageData.Account_CardNo = retValue.returnObject.Account_CardNo;
                        _PageData.Account_Province = retValue.returnObject.Account_Province;
                        _PageData.Account_City = retValue.returnObject.Account_City;
                        _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.ContactName = retValue.returnObject.ContactName;
                        _PageData.IDCard = retValue.returnObject.IDCard;
                        _PageData.Phone = retValue.returnObject.Phone;
                        _PageData.QQ = retValue.returnObject.QQ;
                        _PageData.Email = retValue.returnObject.Email;
                        _PageData.Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Status = retValue.returnObject.Status;
                        _PageData.Create_IP = retValue.returnObject.Create_IP;
                        callback();
                    });
                },
                //用户信息列表
                function (callback) {
                    DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.NickName = retValue.returnObject.NickName;
                        _PageData.Sex = retValue.returnObject.Sex;
                        _PageData.RealName = retValue.returnObject.RealName;
                        //_PageData.Email = retValue.returnObject.Email;
                        //_PageData.Phone = retValue.returnObject.Phone;
                        _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                        _PageData.EXP = retValue.returnObject.EXP;
                        _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Coin = retValue.returnObject.Coin;
                        _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                        _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                        _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                        _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                        _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                        // _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                        _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                        _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                        _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                        // _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.Fans = retValue.returnObject.Fans;
                        _PageData.Attention = retValue.returnObject.Attention;
                        _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                        _PageData.IsFamily = retValue.returnObject.IsFamily;
                        _PageData.Login_Count = retValue.returnObject.Login_Count;
                        _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                        // _PageData.Create_Date = retValue.returnObject.Create_Date;
                        //_PageData.Status = retValue.returnObject.Status;
                        callback();
                    });
                }
            ], function (retValue) {
                _PageData.TagsList = CommonUtils.Anchor.Tags;
                _PageData.Banks = CommonUtils.User.Banks;
                if (retValue) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/family-manage/edit", callback);
                    return;
                }
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/family-manage/edit", callback);
            })
        },
        Anchor: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                Family_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.Family_ID > 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/family-manage/anchor", callback);
            }
        },
        Apply_Edit: function (req, res, callback) {
            var _PageData = {
                flag: 0,
                Family_ID: KOC.StringUtils.ToInt(req.params.id, -1)
            };
            if (_PageData.Family_ID <= 0) {
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/family-manage/apply-edit", callback);
                return;
            }
            KOC.Async.series([
                // 公会信息列表
                function (callback) {
                    DALFactory.User.Family_Info.Info(_PageData.Family_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.Family_ID = retValue.returnObject.Family_ID;
                        _PageData.Family_Name = retValue.returnObject.Family_Name;
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.Account_BankName = retValue.returnObject.Account_BankName;
                        _PageData.Account_BankFullName = retValue.returnObject.Account_BankFullName;
                        _PageData.Account_RealName = retValue.returnObject.Account_RealName;
                        _PageData.Account_CardNo = retValue.returnObject.Account_CardNo;
                        _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.ContactName = retValue.returnObject.ContactName;
                        _PageData.IDCard = retValue.returnObject.IDCard;
                        _PageData.Family_Phone = retValue.returnObject.Phone;
                        _PageData.Family_QQ = retValue.returnObject.QQ;
                        _PageData.Family_Email = retValue.returnObject.Email;
                        _PageData.Create_Date = retValue.returnObject.Create_Date;
                        _PageData.Status = retValue.returnObject.Status;
                        _PageData.Create_IP = retValue.returnObject.Create_IP;
                        callback();
                    });
                },
                //用户信息列表
                function (callback) {
                    DALFactory.User.User_Info.Info(_PageData.User_ID, function (retValue) {
                        if (retValue.hasError) {
                            callback(retValue);
                            return;
                        }
                        _PageData.User_ID = retValue.returnObject.User_ID;
                        _PageData.NickName = retValue.returnObject.NickName;
                        _PageData.Sex = retValue.returnObject.Sex;
                        _PageData.RealName = retValue.returnObject.RealName;
                        _PageData.Email = retValue.returnObject.Email;
                        _PageData.Phone = retValue.returnObject.Phone;
                        _PageData.VIP = retValue.returnObject.VIP && (!retValue.returnObject.VIP_Expire || KOC.Moment().isBefore(retValue.returnObject.VIP_Expire));
                        _PageData.EXP = retValue.returnObject.EXP;
                        _PageData.Level = CommonUtils.User.Level.fnLevel(retValue.returnObject.EXP);
                        _PageData.Coin = retValue.returnObject.Coin;
                        _PageData.Coin_Today = retValue.returnObject.Coin_Today;
                        _PageData.Coin_Week = retValue.returnObject.Coin_Week;
                        _PageData.Coin_Month = retValue.returnObject.Coin_Month;
                        _PageData.Coin_Year = retValue.returnObject.Coin_Year;
                        _PageData.Coin_Total = retValue.returnObject.Coin_Total;
                        // _PageData.Beans = retValue.returnObject.Beans;
                        _PageData.Beans_Today = retValue.returnObject.Beans_Today;
                        _PageData.Beans_Week = retValue.returnObject.Beans_Week;
                        _PageData.Beans_Month = retValue.returnObject.Beans_Month;
                        _PageData.Beans_Year = retValue.returnObject.Beans_Year;
                        // _PageData.Beans_Total = retValue.returnObject.Beans_Total;
                        _PageData.Fans = retValue.returnObject.Fans;
                        _PageData.Attention = retValue.returnObject.Attention;
                        _PageData.IsAnchor = retValue.returnObject.IsAnchor;
                        _PageData.IsFamily = retValue.returnObject.IsFamily;
                        _PageData.Login_Count = retValue.returnObject.Login_Count;
                        _PageData.Login_This_Date = retValue.returnObject.Login_This_Date;
                        // _PageData.Create_Date = retValue.returnObject.Create_Date;
                        //_PageData.Status = retValue.returnObject.Status;
                        callback();
                    });
                }
            ], function (retValue) {
                if (retValue) {
                    _PageData.flag = retValue.message;
                    CommonUtils.Common.PageScript_PageData(res, _PageData);
                    res.render("user-manage/family-manage/apply-edit", callback);
                    return;
                }
                CommonUtils.Common.PageScript_PageData(res, _PageData);
                res.render("user-manage/family-manage/apply-edit", callback);
            })
        }
    }
};